﻿using Architecture.Repository.Impl;
using Architeture.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Architecture.Domain.Service
{
    public class HealthCareService : IHealthCareService
    {
        protected readonly HealthCareRepository healthCare;

        public HealthCareService(HealthCareRepository healthCare)
        {
            this.healthCare = healthCare;
        }

        public async Task<List<HealthCare>> GetHealthCare(int id)
        {
            var lsit = (await healthCare.GetAllAsync()).Where(x => x.GoodsInfoid == id);
            return lsit.ToList();
        }

        public async Task<int> HealthAdd(HealthCare a)
        {
            return await healthCare.AddAsync(a);
        }

        public async Task<int> HealthDel(int id)
        {
            return await healthCare.Delete(id);
        }

        public async Task<int> HealthUpd(HealthCare a)
        {
            return await healthCare.Update(a);
        }
    }
}
